package com.hyt.it.ogt.kq.service.gov.feign.ks.model;

import java.util.Arrays;
import java.util.Objects;

/**
 * 
 *
 * @author zhoumiao
 * @since 2023/3/2 13:53
 **/
public enum AdmissionConsumeEnum {
    CANDIDATE_INSERT("candidate_insert", "新增考生"),
    CANDIDATE_DELETE("candidate_delete", "删除考生"),
    CANDIDATE_UPDATE("candidate_update", "更新考生"),
    EXAM_UPDATE("exam_update", "更新考试"),
    ;
    private String code;
    private String text;

    AdmissionConsumeEnum(String code, String text) {
        this.code = code;
        this.text = text;
    }

    public String getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static AdmissionConsumeEnum admissionConsumeEnum(String code) {
        return Arrays.stream(AdmissionConsumeEnum.values())
                .filter(e -> Objects.equals(code, e.getCode()))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("非法code：" + code));
    }
}
